Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to silence DM messages from HeyFireball #14 #21

Merged
merged 11 commits into from
Nov 18, 2017
Merged

Ability to silence DM messages from HeyFireball #14 #21

merged 11 commits into from
Nov 18, 2017

Conversation

JacobJerrell
Copy link

PM Functionality is fully functional for InMemoryStorage. Testing is needed for Azure, and Redis. Some housekeeping was done; commented out unused functions/methods, corrected formatting.

The bot accepts the following commands:
@[botname] setpm -- Acts as a toggle
@[botname] setpm on
@[botname] setpm off

switched to dev branch, back to InMemoryStorage only
Removed debugging lines, got rid of/commented out unused code
Remove spaces. PM Preference options are now in Azure, Redis, and InMemoryStorage.
Testing is needed for Azure, and Redis
if/elif/else clause to handle user's pm preference options when the bot needs to send a message
@JacobJerrell JacobJerrell changed the title #14 Ability to silence DM's Ability to silence DM messages from HeyFireball #14 Nov 14, 2017
@@ -385,7 +395,8 @@ def create_user_entry(self, user_id: str):
"""Create new user entry and init fields."""
self._data[user_id] = {
self.POINTS_USED : 0,
self.POINTS_RECEIVED : 0
self.POINTS_RECEIVED : 0,
self.PM_PREFERENCE: 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work with the table schema that exists already @MattPitlyk ? Do we have to worry about this setting defaulting back to some value each day?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine. The daily resets are for explicitly specified fields, so if we don't put the preference setting in the daily rest function, it won't be reset.

Something goofy happened previously. PM Preference options are coded out for Azure and Redis storage options now.
Testing still needed.
ignore it
hey_fireball.py Outdated
@@ -19,7 +19,6 @@
BOT_ID = os.environ.get("BOT_ID")
EMOJI = os.environ.get('EMOJI')
POINTS = os.environ.get('POINTS')
SELF_POINTS = os.environ.get('SELF_POINTS', "DISALLOW")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove getting this env var? It's being used in handle_command.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some issues with github last night. Should be sorted out now

hey_fireball.py Outdated
@@ -80,6 +79,9 @@ def __init__(self, msg):
self.target_name = self.target_id
self.command = self._extract_command()
self.count = self._extract_count()
self.setting = self._extract_setting()
self.setting = self._extract_setting() # Find on/off or assume toggle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is repeated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things like this happened last night. I was trying to pick and choose what to push, and made several errors. Sorted it out, and stopped using the computer immediately

hey_fireball.py Outdated
idx = 2
curPref = get_pm_preference(self.requestor_id)
try:
self.parts[idx]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a try-except, I would check the length of self.parts to determine if which logic branch to execute. Typically, try-except is only using for flow control like this if the statement because caught does something (adds a value to a collection, gets next value in a collection, etc.), but self.parts[idx] does not serve a purpose other than to determine if idx=2 is value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try-except has been removed. Now we're checking if self.parts < 3

Checking for length of self.parts to decide if it should act as a toggle. Instead of a try/except for an IndexError
Testing the possibility of having the bot reply to user's request for a leaderboard/fullboard.
Bots do not appear to be capable of posting code snippets. So this is an alternative way of 'collapsing' the leaderboard
@MattPitlyk MattPitlyk merged commit e4742b4 into K-2L:develop Nov 18, 2017
@JacobJerrell JacobJerrell deleted the develop branch November 20, 2017 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants